<template>
  <div class="incolumn">
    <div class="incolumn_countr">
      <div class="block">
        <el-form :inline="true" :model="Pagination" class="demo-form-inline">
          <el-form-item label="输入搜索" class="s1">
            <el-input v-model="Pagination.key" placeholder="请输入快递单号" style="width:150%"></el-input>
          </el-form-item>
          <el-form-item label="输入时间" label-width="230px">
            <el-date-picker
              v-model="formInline.time1"
              type="daterange"
              range-separator="-"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              @change="chage"
            ></el-date-picker>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onsubmit">查询</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
    <!-- =================列表表单 =====================  -->
    <div class="incolumn_from">
      <el-table
        :data="tableData_REVIEW"
        style="width: 100%;background-color:#fff"
        :height="autoHeightTable"
        stripe
      >
        <el-table-column label="序号" align="center" type="index" width="170"></el-table-column>
        <el-table-column prop="applyTime" label="申请日期" align="center"></el-table-column>
        <el-table-column prop="supplierName" label="事由" align="center">
          <template v-slot="scope">
            <span v-show="scope.row.type==10">采购合同</span>
            <span v-show="scope.row.type==11">采购订单</span>
            <span v-show="scope.row.type==12">采购退货</span>
            <span v-show="scope.row.type==13">订单入库</span>
            <span v-show="scope.row.type==14">销售合同</span>
            <span v-show="scope.row.type==15">销售订单</span>
            <span v-show="scope.row.type==16">开票审核</span>
            <span v-show="scope.row.type==17">付款审核</span>
            <span v-show="scope.row.type==22">站点返件</span>
          </template>
        </el-table-column>
        <el-table-column prop="userName" label="申请人" align="center">
        </el-table-column>
        <el-table-column label="状态" align="center">
          <template v-slot="scope">
            <span v-show="scope.row.shengheStatus==1">待审核</span>
            <el-button v-if="scope.row.shengheStatus == 2" type="text" size="medium"
                       @click="getBOhui(scope.row.checkFolwId)">驳回
            </el-button>
<!--            <span v-show="scope.row.shengheStatus==2">驳回</span>-->
            <span v-show="scope.row.shengheStatus==3">已完成</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center">
          <template slot-scope="scope">
            <el-button v-if="scope.row.shengheStatus==1" type="primary" size="small"
                       @click="examine(scope.row.id,scope.row.type,isDetail=false,scope.row.checkFolwId)">审核
            </el-button>
            <el-button type="text" size="small"
                       @click="examine(scope.row.id,scope.row.type,isDetail=true,scope.row.checkFolwId)">详情
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="bottom_slate">
        <el-pagination
          background
          layout="prev, pager, next"
          :current-page="Pagination.current"
          :page-size="Pagination.pagesize"
          @current-change="handleCurrentChange"
          :total="Pagination.total"
        ></el-pagination>
      </div>
      <!--=========采购订单===弹框==================-->
      <el-dialog :visible.sync="dialog_PurchaseOrder" :modal-append-to-body="false" width="1200px">
        <div class="herd_bud"></div>
        <div class="from_cg">采购详情</div>
        <br/>
        <p class="Purchase_Division"></p>
        <div class="Demo_xs">
          <el-form
            :model="PurchaseOrder_formInlineBy"
            :inline="true"
            class="demo-form-inline"
            label-width="100px"
          >
            <el-form-item label="供货商">
              <el-input v-model="PurchaseOrder_formInlineBy.supplierName" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="采购单号">
              <el-input v-model="PurchaseOrder_formInlineBy.orderNumber" :disabled="true"></el-input>
            </el-form-item>
          </el-form>
          <el-table
            :data="PurchaseOrder_tableData_PRODUCT"
            height="400"
            :max-height="400">
            <el-table-column label="序号" align="center" type="index" width="140">

            </el-table-column>
            <el-table-column prop="productNumber" label="产品图号" align="center">
<!--              <template slot-scope="scope">-->
<!--                <el-input disabled v-model="scope.row.productNumber"></el-input>-->
<!--              </template>-->
            </el-table-column>
            <el-table-column prop="productName" label="产品名称" align="center">
<!--              <template slot-scope="scope">-->
<!--                <el-input disabled v-model="scope.row.productName"></el-input>-->
<!--              </template>-->
            </el-table-column>
            <el-table-column prop="number" label="采购数量" align="center">
<!--              <template slot-scope="scope">-->
<!--                <el-input disabled v-model="scope.row.number"></el-input>-->
<!--              </template>-->
            </el-table-column>
            <el-table-column prop="price" label="单价(元)" align="center">
<!--              <template slot-scope="scope">-->
<!--                <el-input disabled v-model="scope.row.price"></el-input>-->
<!--              </template>-->
            </el-table-column>
            <el-table-column prop="xiaoji" label="小计(元)" align="center">
<!--              <template slot-scope="scope">-->
<!--                <el-input disabled v-model="scope.row.xiaoji"></el-input>-->
<!--              </template>-->
            </el-table-column>
            <el-table-column label="到货时间" align="center">
              <template slot-scope="scope">
                {{geshiTime(scope.row.daohuoTime)}}
              </template>
            </el-table-column>
            <el-table-column prop="tiqianTixing" label="提前时间" align="center">
<!--              <template slot-scope="scope">-->
<!--                <el-input disabled v-model="scope.row.tiqianTixing"></el-input>-->
<!--              </template>-->
            </el-table-column>
          </el-table>
          <br/>
          <p class="Purchase_Division"></p>
          <div class="from_towbs">
            <el-button v-if="isDetail==false" @click="dialog_PurchaseOrder = false||pass(1)" type="primary"
                       size="small">通过
            </el-button>
            <el-button v-if="isDetail==false" @click="disAllowance()" type="info" size="small">驳回</el-button>
            <el-button v-if="isDetail==true" @click="dialog_PurchaseOrder = false" type="info" size="small">取消
            </el-button>
          </div>
        </div>
      </el-dialog>
      <!--=================采购退货===========================-->
      <el-dialog :visible.sync="dialog_PurchaseReturnGoods" :modal-append-to-body="false" width="1300px">
        <div class="herd_bud"></div>
        <div class="from_bt">退货详情</div>
        <div style="width: 100%;height: 60px;border-top: 1px solid rgb(220, 222, 226);padding-top: 10px">
          <span style="display: inline-block;font-size: 14px;color: #333333;width: 80px">供货商:</span>
          <el-input disabled style="width: 220px"
                    v-model="dialog_PurchaseReturnGoods_supplierDetail.supplierName"></el-input>
        </div>
        <div style="width: 100%">
          <span>产品：</span>
          <el-table
            :data="dialog_PurchaseReturnGoods_tableData_PRODUCTDETAIL"
            style="width: 100%;height: 300px"
            :max-height="300"
          >
            <el-table-column type="index" label="序号" align="center" width="80"></el-table-column>
            <el-table-column prop="productNumber" label="产品图号" width="180" align="center"></el-table-column>
            <el-table-column
              prop="productName"
              label="产品名称"
              align="center">
            </el-table-column>
            <el-table-column
              prop="price"
              label="单价(元)"
              align="center">
            </el-table-column>
            <el-table-column
              prop="danwei"
              label="单位"
              align="center">
            </el-table-column>
            <el-table-column
              prop="chengpinkuNumber"
              label="成品退货数"
              align="center">
            </el-table-column>
            <el-table-column
              prop="feipinkuNumber"
              label="废品退货数"
              align="center">
            </el-table-column>
            <el-table-column
              prop="moneySum"
              label="小计"
              align="center">
            </el-table-column>
            <el-table-column
              prop="number"
              label="退货总数"
              align="center">
            </el-table-column>
          </el-table>
        </div>
        <div class="from_tab_btn" style="display:flex;justify-content: center;align-items: center">
          <el-button v-if="isDetail==false" @click="pass_returnGood(1)" type="primary" size="small">确 认</el-button>
          <el-button v-if="isDetail==false" @click="disAllowance_returnGood()" type="primary" size="small">驳 回
          </el-button>
          <el-button v-if="isDetail==true" @click="dialog_PurchaseReturnGoods = false" type="info" size="small">取 消
          </el-button>
        </div>
      </el-dialog>
      <!--=================开票=========================================-->
      <el-dialog :visible.sync="dialog_PurchaseKaiPiao" :modal-append-to-body="false" width="1300px">
        <div class="herd_bud"></div>
        <div class="from_bt">开票详情</div>
        <!--供应商-->
        <div style="height: 70px">
          <el-form :inline="true" :model="PurchaseKaiPiao_fromDataSupplier" style="height: 100%">
            <el-form-item label="供应商名称">
              <el-input disabled v-model="PurchaseKaiPiao_fromDataSupplier.supplierName"></el-input>
            </el-form-item>
            <el-form-item label="联系人">
              <el-input disabled v-model="PurchaseKaiPiao_fromDataSupplier.lianxiren"></el-input>
            </el-form-item>
            <el-form-item label="联系方式">
              <el-input disabled v-model="PurchaseKaiPiao_fromDataSupplier.phone"></el-input>
            </el-form-item>
            <el-form-item label="总金额">
              <el-input disabled v-model="PurchaseKaiPiao_fromDataSupplier.moneySum"></el-input>
            </el-form-item>
          </el-form>
        </div>
        <!--本次审核的开票的信息-->
        <div
          style="font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;font-size: 14px;width: 100%;margin-top: 15px">
          开票审核 ：
        </div>
        <div class="purInfo002" style="margin-top: 15px">
          <el-table :data="PurchaseKaiPiao_tableDataKaiPiao"
                    width="100%"
                    height="300px"
                    :max-height="150"
                    :row-style="{height:'37px'}"
          >
            <el-table-column type="index" width="150" align="center" label="序号"></el-table-column>
            <el-table-column prop="piaoNumber" label="票号" align="center">
            </el-table-column>
            <el-table-column prop="kaipiaoTime" label="开票时间" align="center">
              <template v-slot="scope">
                <div>{{geshiTime(scope.row.kaipiaoTime)}}</div>
              </template>
            </el-table-column>
            <el-table-column prop="status" label="状态" align="center">
              <template v-slot="scope">
                <div v-if="scope.row.status==1" style="color: red">待审核</div>
                <div v-if="scope.row.status==2" >驳回</div>
                <div v-if="scope.row.status==3">已完成</div>
              </template>
            </el-table-column>
            <el-table-column prop="money" label="发票金额" align="center">
            </el-table-column>
          </el-table>
        </div>
        <!--开票记录-->
        <div style="font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;font-size: 14px;width: 100%;margin-top: 15px">
          开票记录 ：
        </div>
        <div class="purInfo002" style="margin-top: 15px">
          <el-table :data="PurchaseKaiPiao_tableDataKaiPiaoLog"
                    width="100%"
                    height="300px"
                    :max-height="150"
                    :row-style="{height:'37px'}"
          >
            <el-table-column type="index" width="150" align="center" label="序号"></el-table-column>
            <el-table-column prop="piaoNumber" label="票号" align="center">
            </el-table-column>
            <el-table-column prop="kaipiaoTime" label="开票时间" align="center">
              <template v-slot="scope">
                <div>{{geshiTime(scope.row.kaipiaoTime)}}</div>
              </template>
            </el-table-column>
            <el-table-column prop="status" label="状态" align="center">
              <template slot-scope="scope">
                <span v-if="scope.row.status==1">待审核</span>
                <span v-if="scope.row.status==2" style="color: red">驳回</span>
                <span v-if="scope.row.status==3">已通过</span>
              </template>
            </el-table-column>
            <el-table-column prop="money" label="发票金额" align="center">
            </el-table-column>
          </el-table>
        </div>
        <div class="from_tab_btn" style="display:flex;justify-content: center;align-items: center">
          <el-button v-if="isDetail==false" @click="pass_kaipiao(1)" type="primary" size="small">确 认</el-button>
          <el-button v-if="isDetail==false" @click="disAllowance_kaipiao()" type="primary" size="small">驳 回
          </el-button>
          <el-button v-if="isDetail==true" @click="dialog_PurchaseKaiPiao = false" type="info" size="small">取 消
          </el-button>
        </div>
      </el-dialog>
      <!--=================付款=========================================-->
      <el-dialog :visible.sync="dialog_PurchaseFuKuan" :modal-append-to-body="false" width="1300px">
        <div class="herd_bud"></div>
        <div class="from_bt">付款详情</div>
        <!--供应商-->
        <div style="height: 100px">
          <el-form :inline="true" :model="PurchaseFuKuan_fromDataSupplier" style="height: 100%">
            <el-form-item label="供应商名称">
              <el-input disabled v-model="PurchaseFuKuan_fromDataSupplier.supplierName"></el-input>
            </el-form-item>
            <el-form-item label="联系人">
              <el-input disabled v-model="PurchaseFuKuan_fromDataSupplier.lianxiren"></el-input>
            </el-form-item>
            <el-form-item label="联系方式">
              <el-input disabled v-model="PurchaseFuKuan_fromDataSupplier.phone"></el-input>
            </el-form-item>
            <el-form-item label="总金额">
              <el-input disabled v-model="PurchaseFuKuan_fromDataSupplier.moneySum"></el-input>
            </el-form-item>
            <br>
            <el-form-item label="本次付款金额">
              <el-input disabled v-model="PurchaseFuKuan_fromDataSupplier.jieSuanMoneyNow"></el-input>
            </el-form-item>
          </el-form>
        </div>
        <!--本次审核的付款的信息-->
       <!-- <div
          style="font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;font-size: 14px;width: 100%;margin-top: 15px">
          付款审核 ：
        </div>
        <div class="purInfo002" style="margin-top: 15px">
          <el-table :data="PurchaseFuKuan_tableDataFuKuan"
                    width="100%"
                    height="300px"
                    :max-height="150"
                    :row-style="{height:'37px'}"
          >
            <el-table-column type="index" width="150" align="center" label="序号"></el-table-column>
            <el-table-column prop="piaoNumber" label="付款金额" align="center">
            </el-table-column>
            <el-table-column prop="kaipiaoTime" label="付款时间" align="center">
            </el-table-column>
          </el-table>
        </div>-->
        <!--付款记录-->
        <div style="font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;font-size: 14px;width: 100%;margin-top: 15px">
          开票记录 ：
        </div>
        <div class="purInfo002" style="margin-top: 15px">
          <el-table :data="PurchaseFuKuan_tableDataFuKuanLog"
                    width="100%"
                    height="300px"
                    :max-height="150"
                    :row-style="{height:'37px'}"
          >
            <el-table-column type="index" align="center" label="序号" width="140"></el-table-column>
            <el-table-column prop="fukuanMoney" label="付款金额" align="center">
            </el-table-column>
            <el-table-column prop="status" label="状态" align="center">
              <template slot-scope="scope">
                <span v-if="scope.row.status==1">待审核</span>
                <span v-if="scope.row.status==2" style="color: red">驳回</span>
                <span v-if="scope.row.status==3">已通过</span>
              </template>
            </el-table-column>

            <el-table-column prop="createonTime" label="付款时间" align="center">
              <template v-slot="scope">
                <div>{{geshiTime(scope.row.createonTime)}}</div>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="from_tab_btn" style="display:flex;justify-content: center;align-items: center">
          <el-button v-if="isDetail==false" @click="pass_fukuan(1)" type="primary" size="small">确 认</el-button>
          <el-button v-if="isDetail==false" @click="disAllowance_fukuan()" type="primary" size="small">驳 回
          </el-button>
          <el-button v-if="isDetail==true" @click="dialog_PurchaseFuKuan = false" type="info" size="small">取 消
          </el-button>
        </div>
      </el-dialog>
      <!--=========================驳回======================================-->
      <!--采购订单-->
      <el-dialog
        title="驳回理由"
        :visible.sync="dialogVisible_refuse"
        width="30%"
        append-to-body>
        <el-input v-model="bohui"></el-input>
        <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible_refuse = false">取 消</el-button>
    <el-button type="primary" @click="pass(2)">确 定</el-button>
          </span>
      </el-dialog>
      <!--采购退货-->
      <el-dialog
        title="驳回理由"
        :visible.sync="dialogVisible_refuse_returnGood"
        width="30%"
        append-to-body>
        <el-input v-model="bohui"></el-input>
        <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible_refuse_returnGood = false">取 消</el-button>
    <el-button type="primary" @click="pass_returnGood(2)">确 定</el-button>
  </span>
      </el-dialog>
      <!--开票-->
      <el-dialog
        title="驳回理由"
        :visible.sync="dialogVisible_refuse_KaiPiao"
        width="30%"
        append-to-body>
        <el-input v-model="bohui"></el-input>
        <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible_refuse_KaiPiao = false">取 消</el-button>
    <el-button type="primary" @click="pass_kaipiao(2)">确 定</el-button>
  </span>
      </el-dialog>
      <!--付款-->
      <el-dialog
        title="驳回理由"
        :visible.sync="dialogVisible_refuse_FuKuan"
        width="30%"
        append-to-body>
        <el-input v-model="bohui"></el-input>
        <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible_refuse_FuKuan = false">取 消</el-button>
    <el-button type="primary" @click="pass_fukuan(2)">确 定</el-button>
  </span>
      </el-dialog>

      <!--=========d订单入库===弹框==================-->
      <el-dialog :visible.sync="dialog_dingdanruku" :modal-append-to-body="false" width="1200px">
        <div class="herd_bud"></div>
        <div class="from_cg">入库详情</div>
        <br/>
        <p class="Purchase_Division"></p>
        <div class="Demo_xs">
          <el-form
            :model="dialog_dingdanruku_supplierDetailL"
            :inline="true"
            class="demo-form-inline"
            label-width="100px"
          >
            <el-form-item label="供货商">
              <el-input v-model="dialog_dingdanruku_supplierDetailL.supplierName" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="采购单号">
              <el-input v-model="dialog_dingdanruku_supplierDetailL.orderNumber" :disabled="true"></el-input>
            </el-form-item>
          </el-form>

          <el-table
            :data="dialog_dingdanruku_tableData_PRODUCTDETAIL"
            height="400"
            :max-height="400">
            <el-table-column label="序号" align="center" type="index" width="70px">

            </el-table-column>
            <el-table-column label="产品图号" align="center">
              <template slot-scope="scope">
                <el-input disabled v-model="scope.row.productNumber"></el-input>
              </template>
            </el-table-column>
            <el-table-column label="产品名称" align="center">
              <template slot-scope="scope">
                <el-input disabled v-model="scope.row.productName"></el-input>
              </template>
            </el-table-column>
            <el-table-column label="本次入库数" align="center">
              <template slot-scope="scope">
                <el-input disabled v-model="scope.row.number"></el-input>
              </template>
            </el-table-column>
            <el-table-column label="单价(元)" align="center">
              <template slot-scope="scope">
                <el-input disabled v-model="scope.row.price"></el-input>
              </template>
            </el-table-column>
            <el-table-column label="小计(元)" align="center">
              <template slot-scope="scope">
                <el-input disabled v-model="scope.row.xiaoji=scope.row.price*scope.row.number" ></el-input>
              </template>
            </el-table-column>
<!--            <el-table-column label="已入库" align="center">-->
<!--              <template slot-scope="scope">-->
<!--                <el-input disabled v-bind:value="scope.row.rukuNumber|groupTypeNULLTrans"></el-input>-->
<!--              </template>-->
<!--            </el-table-column>-->
<!--            <el-table-column label="申请中" align="center">-->
<!--              <template slot-scope="scope">-->
<!--                <el-input disabled v-bind:value="scope.row.applyingNumber|groupTypeNULLTrans">-->
<!--                </el-input>-->
<!--              </template>-->
<!--            </el-table-column>-->
          </el-table>
          <br/>
          <p class="Purchase_Division"></p>
          <div class="from_towbs">
            <el-button type="primary" size="medium" @click="tongguo()" v-if="isDetail==false">确定
            </el-button>
            <el-button size="medium" @click="dialog_dingdanruku_bohui = true" v-if="isDetail==false">驳回</el-button>
            <el-button type="info" size="medium" @click="dialog_dingdanruku=false" v-if="isDetail==true">返回</el-button>
          </div>
        </div>
      </el-dialog>
      <!--  订单入库-->
      <el-dialog
        title="驳回"
        :visible.sync="dialog_dingdanruku_bohui"
        width="30%"
        :modal-append-to-body="false">
        <span>驳回理由 : </span>
        <el-input style="width: 80%" v-model="bohuiList" placeholder="请输入驳回理由"></el-input>
        <span slot="footer" class="dialog-footer">
    <el-button type="primary" @click=" getbo()">确 定</el-button>
    <el-button @click="dialog_dingdanruku_bohui = false">取 消</el-button>
  </span>
      </el-dialog>

      <el-dialog
        title="驳回详情"
        :visible.sync="dialogVisible_bohui"
        width="50%"
        :modal-append-to-body="false">
        <ul :data="bohuilist" class="bohuizujian">
          <li>
            <span>审核日期</span>
            <el-input v-model="bohuilist.checkTime" style="width: 70%;" disabled></el-input>
          </li>
          <li>
            <span>审核人</span>
            <el-input v-model="bohuilist.userName" style="width: 70%;" disabled></el-input>
          </li>
          <li>
            <span>驳回理由</span>
            <el-input v-model="bohuilist.bohuiReason" style="width: 70%;" disabled></el-input>
          </li>
        </ul>
        <span slot="footer" class="dialog-footer">
    <el-button type="primary" @click="dialogVisible_bohui = false">返 回</el-button>
  </span>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import axios from 'axios'

export default {
  name: "ExamineManage",
  inject: ['reload'],
  components: {},
  data() {
    return {
      dialogVisible_bohui: false,
      bohuilist:{
        bohuiReason:"",
        checkTime:"",
        userName:"",
      },
      /*================列表数据==========================*/
      isDetail: false,
      bohui: "",
      PurchaseFuKuan_tableDataFuKuan:[],
      PurchaseFuKuan_tableDataFuKuanLog:[],
      tableData_PRODUCTRUKULOG:[],
      PurchaseFuKuan_fromDataSupplier:{},//付款供应商的基本信息
      PurchaseKaiPiao_fromDataSupplier: {},//开票供应商的基本信息
      PurchaseOrder_formInlineBy: {},
      tableData_REVIEW: [],
      PurchaseKaiPiao_tableDataKaiPiao: [],
      PurchaseKaiPiao_tableDataKaiPiaoLog: [],
      PurchaseOrder_tableData_PRODUCT: [],
      dialog_PurchaseReturnGoods_supplierDetail: {},////采购退货管理供应商详情
      dialog_PurchaseReturnGoods_tableData_PRODUCTDETAIL: [],//采购退货管理的产品
      dialog_dingdanruku_tableData_PRODUCTDETAIL: [],//订单入库管理的产品
     dialog_dingdanruku_supplierDetailL: {},//订单入库管理供应商详情
      bohuiList:"",
      formInline: "",
      Pagination: {
        beginTime: "",
        endTime: "",
        key: "",
        total: 1,//总共页
        current: 1,//当前页
        pagesize: 10,//页面数据个数
      },
      /*=================弹框===========================*/
      dialog_PurchaseOrder: false,//采购订单
      dialogVisible_refuse: false,//驳回
      dialog_PurchaseReturnGoods: false,//采购退货
      dialog_PurchaseKaiPiao: false,//开票
      dialog_PurchaseFuKuan: false,//付款
      dialogVisible_refuse_returnGood: false,//驳回
      dialogVisible_refuse_FuKuan:false,//驳回
      dialogVisible_refuse_KaiPiao:false,//驳回
      dialog_dingdanruku :false,
      dialog_dingdanruku_bohui :false,
    };
  },
//监听属性 类似于data概念",
  computed: {
    autoHeightTable() {
      return document.documentElement.scrollHeight - 251 - 93
    }
  },
//监控data中的数据变化",
  watch: {},
//方法集合",
  methods: {
    getBOhui(checkflowId) {
      this.dialogVisible_bohui = true
      axios("/JX_java/procurement/getCheckFlowDetails?checkFlowId=" + checkflowId).then((res) => {
        console.log(res)
        let relse = res.data.data
        this.bohuilist = relse
        console.log(this.bohuilist)
      })
    },
    //通过
    tongguo() {
      const arr = {
        "bohui": "",
        "checkFolwId": this.dialog_dingdanruku_supplierDetailL.checkFlowId,
        "shengheMessageId": this.dialog_dingdanruku_supplierDetailL.id,
        "status": 3,
        "userId": this.userId,
        "userName": this.userName
      }
      console.log(arr)
      // return
      axios
        .post(
          "/JX_java/procurement/caigoushenghe/updatestatus", arr
        )
        .then((res) => {
          if (res.data.data == "操作成功") {
            this.$message.success(res.data.data);
            this.dialog_dingdanruku = false
            this.getList();
          } else {
            this.$message.error(res.data.data);
          }
        });
    },

    // 驳回函数
    getbo() {
      if (this.bohuiList == "") {
        this.$message.error("驳回理由不能为空！");
        return;
      }
      const arr = {
        "bohui": this.bohuiList,
        "checkFolwId": this.dialog_dingdanruku_supplierDetailL.checkFlowId,
        "shengheMessageId": this.dialog_dingdanruku_supplierDetailL.id,
        "status": 2,
        "userId": this.userId,
        "userName": this.userName,
      }
      // return
      axios
        .post(
          "/JX_java/procurement/caigoushenghe/updatestatus", arr
        )
        .then((res) => {
          if (res.data.data == "操作成功") {
            this.$message.success(res.data.data);
            this.dialog_dingdanruku_bohui = false
            this.dialog_dingdanruku = false
            this.getList();
          } else {
            this.$message.error(res.data.data);
          }
        });
    },

    /*---------------------------------------许--------------------------------------------*/
    pass_fukuan(type){
      let statue = type == 1 ? 3 : 2
      const message = JSON.parse(localStorage.getItem("message"))
      if (type == 2) {
        if (this.bohui == "") {
          this.$message.error("驳回理由不能为空！");
          return;
        }
      }
        const param = {
          "bohui": this.bohui,
          "checkFolwId": this.PurchaseFuKuan_fromDataSupplier.checkFolwId,
          "shengheMessageId": this.PurchaseFuKuan_fromDataSupplier.id,
          "status": statue,
          "userId": message.Id,
          "userName": message.Name
        }
        console.log(param)
        axios.post("/JX_java/procurement/caigoushenghe/updatestatus", param).then(res => {
          console.log(res.data.data);
          if (res.data.data == "操作成功") {
            this.$message.success(res.data.data);
            this.reload();
            this.dialog_PurchaseFuKuan=false;
          } else {
            this.$message.error(res.data.data);
          }
        })

    },
    disAllowance_fukuan(){
      this.bohui = ""
      this.dialog_PurchaseFuKuan = false;
      this.dialogVisible_refuse_FuKuan = true;
    },
    pass_kaipiao(type) {
      let statue = type == 1 ? 3 : 2
      const message = JSON.parse(localStorage.getItem("message"))
      if (type == 2) {
        if (this.bohui == "") {
          this.$message.error("驳回理由不能为空！");
          return;
        }
      }
      const param = {
        "bohui": this.bohui,
        "checkFolwId": this.PurchaseKaiPiao_fromDataSupplier.checkFolwId,
        "shengheMessageId": this.PurchaseKaiPiao_fromDataSupplier.id,
        "status": statue,
        "userId": message.Id,
        "userName": message.Name
      }
      axios.post("/JX_java/procurement/caigoushenghe/updatestatus", param).then(res => {
        console.log(res.data.data);
        if (res.data.data == "操作成功") {
          this.$message.success(res.data.data);
          this.dialogVisible_refuse_KaiPiao=false;
          this.getList()
        } else {
          this.$message.error(res.data.data);
        }
      })
    },
    disAllowance_kaipiao() {
      this.bohui = ""
      this.dialog_PurchaseKaiPiao = false;
      this.dialogVisible_refuse_KaiPiao = true;
    },
    pass_returnGood(type) {
      let statue = type == 1 ? 3 : 2
      const message = JSON.parse(localStorage.getItem("message"))
      if (type == 2) {
        if (this.bohui == "") {
          this.$message.error("驳回理由不能为空！");
          return;
        }
      }
      const param = {
        "bohui": this.bohui,
        "checkFolwId": this.dialog_PurchaseReturnGoods_supplierDetail.checkFlowId,
        "shengheMessageId": this.dialog_PurchaseReturnGoods_supplierDetail.id,
        "status": statue,
        "userId": message.Id,
        "userName": message.Name
      }
      console.log(param)

      axios.post("/JX_java/procurement/caigoushenghe/updatestatus", param).then(res => {
        console.log(res.data.data)
        if (res.data.data == "操作成功") {
          this.$message.success(res.data.data);
          this.bohui = "";
          this.dialog_PurchaseOrder = false;
          this.reload();
        } else {
          this.$message.error(res.data.data);
        }
      })
    },
    disAllowance_returnGood() {
      this.bohui = ""
      this.dialog_PurchaseReturnGoods = false;
      this.dialogVisible_refuse_returnGood = true;
    },
    disAllowance() {
      this.bohui = ""
      this.dialog_PurchaseOrder = false;
      this.dialogVisible_refuse = true;
    },
    pass(type) {
      let statue = type == 1 ? 3 : 2
      const message = JSON.parse(localStorage.getItem("message"))
      if (type == 2) {
        if (this.bohui == "") {
          this.$message.error("驳回理由不能为空！");
          return;
        }
      }
      const param = {
        "bohui": this.bohui,
        "checkFolwId": this.PurchaseOrder_formInlineBy.checkFlowId,
        "shengheMessageId": this.PurchaseOrder_formInlineBy.id,
        "status": statue,
        "userId": message.Id,
        "userName": message.Name
      };
      console.log(param, this.PurchaseOrder_formInlineBy)
      axios.post("/JX_java/procurement/caigoushenghe/updatestatus", param).then(res => {
        console.log(res.data.data)
        if (res.data.data == "操作成功") {
          this.$message.success(res.data.data);
          this.bohui = "";
          this.dialog_PurchaseOrder = false;
          window.history.go(-1);
        } else {
          this.$message.error(res.data.data);
        }
      })
    },
    examine(id, type, statue, checkFolwId) {
      console.log(id, type, statue, checkFolwId)
      if (type == 10) {//采购合同
        this.$router.push({
          path: "/ExaminePurchaseContract", query: {
            id: id,
            type: type,
            statue: statue,
            checkFolwId: checkFolwId
          }
        })
      }
      if (type == 11) {//采购订单
        this.dialog_PurchaseOrder = true
        axios.get("/JX_java/procurement/caigoushenghe/getshengHeDetails?shengheMessageId=" + id + "&&checkFlowId=" + checkFolwId).then(res => {
          console.log(res.data.data, res.data.data.checkFlowId)
          this.isDetail = statue;
          this.PurchaseOrder_formInlineBy.supplierName = res.data.data.pojo.supplierName
          this.PurchaseOrder_formInlineBy.orderNumber = res.data.data.pojo.orderNumber
          this.PurchaseOrder_formInlineBy.checkFlowId = res.data.data.checkFlowId
          this.PurchaseOrder_formInlineBy.id = id
          this.PurchaseOrder_tableData_PRODUCT = res.data.data.pojo.products
          for(let i = 0 ; i<this.tableData_PRODUCT.length;i++){
            this.PurchaseOrder_tableData_PRODUCT[i].xiaoji = this.PurchaseOrder_tableData_PRODUCT[i].xiaoji.toFixed(2);
          }
          console.log(this.PurchaseOrder_formInlineBy)
        })
      }
      if (type == 12) {//采购退货管理
        axios.get("/JX_java/procurement/caigoushenghe/getshengHeDetails?shengheMessageId=" + id + "&&checkFlowId=" + checkFolwId).then(res => {
          console.log(res.data.data)
          this.dialog_PurchaseReturnGoods_supplierDetail.checkFlowId = res.data.data.checkFlowId
          this.dialog_PurchaseReturnGoods_supplierDetail.id = id
          this.dialog_PurchaseReturnGoods_supplierDetail.supplierName = res.data.data.pojo.supplierName
          this.dialog_PurchaseReturnGoods_tableData_PRODUCTDETAIL = res.data.data.pojo.warehouseLogs;
          this.dialog_PurchaseReturnGoods = true
        })
        console.log(id, type, statue, checkFolwId)
      }
      if (type == 13) {//订单入库
        axios.get("/JX_java/procurement/caigoushenghe/getshengHeDetails?shengheMessageId=" + id + "&&checkFlowId=" + checkFolwId).then(res => {
          console.log(res.data.data,1111111111111111111)
          // this.tableData_PRODUCTRUKULOG=[];
          // this.tableData_PRODUCTRUKULOG = res.data.data.warehouseLogs
          this.dialog_dingdanruku_supplierDetailL.checkFlowId = res.data.data.checkFlowId
          this.dialog_dingdanruku_supplierDetailL.id = id
          this.dialog_dingdanruku_supplierDetailL.supplierName = res.data.data.pojo.supplierName
          this.dialog_dingdanruku_supplierDetailL.orderNumber = res.data.data.pojo.orderNumber
          this.dialog_dingdanruku_tableData_PRODUCTDETAIL = res.data.data.pojo.warehouseLogs;
          this.dialog_dingdanruku = true
          console.log(
            res.data.data.checkFlowId
          )
        })
        console.log(id, type, statue, checkFolwId)
      }
      if (type == 14) {//销售合同审核
        axios.get("/JX_java/procurement/caigoushenghe/getshengHeDetails?shengheMessageId=" + id + "&&checkFlowId=" + checkFolwId).then(res => {
          console.log(res.data.data)
        })
      }
      if (type == 15) {//销售订单审核
        axios.get("/JX_java/procurement/caigoushenghe/getshengHeDetails?shengheMessageId=" + id + "&&checkFlowId=" + checkFolwId).then(res => {
          console.log(res.data.data)
        })
      }
      if (type == 16) {//开票审核
        // console.log(e)
        this.dialog_PurchaseKaiPiao = true
        axios.get("/JX_java/procurement/caigoushenghe/getshengHeDetails?shengheMessageId=" + id + "&&checkFlowId=" + checkFolwId).then(res => {
          this.PurchaseKaiPiao_fromDataSupplier.id = id
          this.PurchaseKaiPiao_fromDataSupplier.checkFolwId = checkFolwId
          this.PurchaseKaiPiao_fromDataSupplier.supplierName = res.data.data.pojo.supplierName
          this.PurchaseKaiPiao_fromDataSupplier.lianxiren = res.data.data.pojo.lianxiren
          this.PurchaseKaiPiao_fromDataSupplier.phone = res.data.data.pojo.phone
          this.PurchaseKaiPiao_fromDataSupplier.moneySum = res.data.data.pojo.moneySum
          const kaipiaos = res.data.data.pojo.kaipiaos
          kaipiaos.forEach(e => {
            console.log(e,id,"eeeee")
            if (e.status == 1) {//本次审核的开票
              this.PurchaseKaiPiao_tableDataKaiPiao.push(e)
            } else {//开票历史记录
              this.PurchaseKaiPiao_tableDataKaiPiaoLog.push(e)
            }
          })
          console.log(res.data.data)
        })
      }
      if (type == 17) {//付款审核
        axios.get("/JX_java/procurement/caigoushenghe/getshengHeDetails?shengheMessageId=" + id + "&&checkFlowId=" + checkFolwId).then(res => {
          console.log(res.data.data)
          this.PurchaseFuKuan_fromDataSupplier.checkFolwId=checkFolwId
          this.PurchaseFuKuan_fromDataSupplier.id=id
          this.PurchaseFuKuan_fromDataSupplier.supplierName=res.data.data.pojo.supplierName
          this.PurchaseFuKuan_fromDataSupplier.lianxiren=res.data.data.pojo.lianxiren
          this.PurchaseFuKuan_fromDataSupplier.phone=res.data.data.pojo.phone
          this.PurchaseFuKuan_fromDataSupplier.moneySum=res.data.data.pojo.moneySum
          this.PurchaseFuKuan_fromDataSupplier.jieSuanMoneyNow=res.data.data.pojo.jieSuanMoneyNow
        this.PurchaseFuKuan_tableDataFuKuanLog=  res.data.data.pojo.fukuans
          this.dialog_PurchaseFuKuan=true
        })
      }


    },
    //产品的详情
    showDetail(id) {
      console.log(id)
      this.$router.push({
        path: "./WAREProductDetail", query: {
          id: id,
          type: 1
        }
      });
    },
    //列表获取
    getList() {
      const data = {
        "beginTime": this.Pagination.beginTime,
        "endTime": this.Pagination.endTime,
        "key": this.Pagination.key,
        "pageNum": this.Pagination.current,
        "pageSize": this.Pagination.pagesize,
        "type": 0
      }
      let message = JSON.parse(localStorage.getItem("message"));
      axios.post("/JX_java/procurement/caigoushenghe/getCaigouShenghe", data).then(res => {
        console.log(res.data.data,111111111111111111111)
        let params = res.data.data;
        this.tableData_REVIEW = params.content;
        this.Pagination.total = res.data.data.totalSize

      })
    },
    chage(e) {
      if (e) {
        this.Pagination.beginTime = e[0];
        this.Pagination.endTime = e[1];
      } else {
        this.Pagination.beginTime = '';
        this.Pagination.endTime = '';
      }
    },
    //格式化时间
    geshiTime(date) {
      return date==null?"":date.substring(0, 10);
    },

    dateFormat(format, time) {
      var t = new Date(time)
      var tf = function (i) {
        return (i < 10 ? '0' : '') + i
      }
      return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function (a) {
        switch (a) {
          case 'yyyy':
            return tf(t.getFullYear())
          // break
          case 'MM':
            return tf(t.getMonth() + 1)
          // break
          case 'mm':
            return tf(t.getMinutes())
          // break
          case 'dd':
            return tf(t.getDate())
          // break
          case 'HH':
            return tf(t.getHours())
          // break
          case 'ss':
            return tf(t.getSeconds())
          // break
        }
      })
    },
    //格式化时间
    renderTime(date) {
      const dateee = new Date(date).toJSON();
      if (date == null) {
        return "---";
      } else {
        return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '');
      }
    },
    //分页方法
    handleCurrentChange(e) {
      this.Pagination.current = e;
      this.getList();
    },
    onsubmit() {
      this.getList();
    },
  },
//生命周期 - 创建之前",数据模型未加载,方法未加载,html模板未加载
  beforeCreate() {
  },
//生命周期 - 创建完成（可以访问当前this实例）",数据模型已加载，方法已加载,html模板已加载,html模板未渲染
  created() {
    this.userId = JSON.parse(localStorage.getItem("message")).Id;
    this.userName = JSON.parse(localStorage.getItem("message")).Name;
    this.getList();
  },
//生命周期 - 挂载之前",html模板未渲染
  beforeMount() {
  },
//生命周期 - 挂载完成（可以访问DOM元素）",html模板已渲染
  mounted() {
  },
//生命周期 - 更新之前",数据模型已更新,html模板未更新
  beforeUpdate() {
  },
//生命周期 - 更新之后",数据模型已更新,html模板已更新
  updated() {
  },
//生命周期 - 销毁之前",
  beforeDestroy() {
  },
//生命周期 - 销毁完成",
  destroyed() {
  },
//如果页面有keep-alive缓存功能，这个函数会触发",
  activated() {
  },
}
</script>

<style lang="scss" scoped>
.bohuizujian{
  display: flex;
  flex-wrap: wrap;
  li{
    width: 33%;
    padding-top: 10px;
    text-align: center;
    span{
      display: inline-block;
      width: 25%;
    }
  }
}

.Suppliermanagement .search {
  height: 50px;
  border-radius: 5px;
  background-color: #fff;
  padding-left: 20px;
  padding-top: 10px;
  margin: 0 20px 20px;
}

.Suppliermanagement .demo-form-inline {
  display: inline-block;
}

.Suppliermanagement .el-pagination {
  margin-top: 15px;
  text-align: center;
}

.Suppliermanagement .ebtn {
  float: right;
  margin-right: 20px;
}

.bottom_slate {
  height: 60px;
  line-height: 40px;
  text-align: center;
}

.from_towbs {
  margin-top: 10px;
  text-align: center;
}
</style>
